<?php
require_once('lib/dbclass.php');
$db = new MySQL();

?>

<?php
if (! $db->Query("select * from galeri
	order by id_foto desc")) $db->Kill(); 
?>
<h2>Admin Galeri</h2>

<div class="tabeledit">
<table width="100%" border="0" cellpadding="0">
  <tr>
    <th align="center" width="5%" bgcolor="#494949"><p>No</p></th>
    <th align="left" width="26%" bgcolor="#494949"><p>Foto </p></th>
    <th align="left" width="25%" bgcolor="#494949"><p>Keterangan</p></th>
    <th align="left" width="27%" bgcolor="#494949"><p>Tanggal</p></th>
    <th align="left" width="17%" bgcolor="#494949"><p>Aksi</p></th>
  </tr>
  <?php $no=1;?>
  <?php while($rs = $db->RowArray()):?>
  <tr>
    <td align="center" valign="top" bgcolor="#CCCCCC"><?php echo $no?></td>
    <td bgcolor="#CCCCCC"><img src="images/galeri/<?php echo $rs['foto']; ?>" alt="" width="161" height="99" /></td>
    <td align="left" valign="top" bgcolor="#CCCCCC"><?php echo $rs['keterangan']?></td>
    <td align="left" valign="top" bgcolor="#CCCCCC"><?php echo $rs['tanggal']?></td>
    <td align="left" valign="top" bgcolor="#CCCCCC"><a class="btn btn-danger" href="hapus_galeri.php?id=<?php echo $rs['id_foto'];?>" onclick="return cekHapus('<?php 
		echo 'ini';?>');"><i class="fa fa-trash-o"></i> Delete</a></td>
  </tr>
  <?php $no++?>
  <?php endwhile;?>
</table>
</div>
<br/>
<br/>
<br/>
<br/>
<a href="?q=61" class="btn btn-danger">
Tambah Galeri
</a>		

<script language="JavaScript">
function cekHapus(nama){
	if(confirm("Yakin akan menghapus Foto : \""+ nama +" ? \"")){
		return true;
	} else {
		return false;
	}
}
</script>

